﻿@model LogType
@Html.Extra()
@{
    Layout = "~/Views/Shared/OA/_Form.cshtml";
}
@section Toolbar
{
    @Html.MyNet().Button(new ButtonOptions { Text = "保存", Click = "save" })
    @Html.MyNet().Button(new ButtonOptions { Text = "返回", Click = "back" })
}
@section Main
{
    @Html.HiddenFor(model => model.Id)
    <table>
        <tr>
            <th>
                @Html.LabelFor(model => model.Name, "名称")
            </th>
            <td>
                @Html.MyNet().TextBoxFor(model => model.Name, new ValidateOptions
               {
                   RequiredError = "请输入名称",
                   LengthMax = 64
               })
                @Html.MyNet().ValidationMessageFor(model => model.Name)
            </td>
        </tr>
        <tr>
            <th>
                @Html.LabelFor(model => model.Key, "代码")
            </th>
            <td>
                @Html.MyNet().TextBoxFor(model => model.Key, new ValidateOptions
               {
                   RequiredError = "请输入代码",
                   LengthMax = 64
               })
                @Html.MyNet().ValidationMessageFor(model => model.Key)
            </td>
        </tr>
        <tr>
            <th>
                @Html.LabelFor(model => model.Config, "字段配置")
            </th>
            <td>
                @Html.MyNet().TextAreaFor(model => model.Config)
            </td>
        </tr>
        <tr>
            <th>
                @Html.LabelFor(model => model.View, "视图Url")
            </th>
            <td>
                @Html.MyNet().TextBoxFor(model => model.View)
            </td>
        </tr>
        <tr>
            <th>
                @Html.LabelFor(model => model.SortIndex, "排序号")
            </th>
            <td>
                @Html.MyNet().IntegerTextBoxFor(model => model.SortIndex, new ValidateOptions
                {
                    RequiredError = "请输入排序号"
                })
                @Html.MyNet().ValidationMessageFor(model => model.SortIndex)
            </td>
        </tr>
    </table>
}
<script>

    function save()
    {
        var form = $("form");
        if (!form.valid()) return;

        $.ajax
        ({
            url: form.attr("action"),
            data: form.serialize(),
            type: "post",
            error: disposeError,
            success: function (result)
            {
                if (disposeException(result)) return;
                back(true);
            }
        });
    }

</script>
